/* GZIP by Raccoon Framework */ /* main.js */ var _ = {}; _.extend = jQuery.extend; _.extend({ mail_regexp : /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/, alert : function(message, callback) { $.blockUI({ message: "" + "
" + "

"+message+"

" + "" + "

" }); $("div.alert_window button#btn_ok").click(function(){ $.unblockUI(); if (typeof callback === 'function') { callback(); } }); }, confirm : function(message, callback) { $.blockUI({ message: "" + "
" + "

"+message+"

" + "" + "" + "

" }); $("div.alert_window button#btn_ok").click(function(){ $.unblockUI(); if (typeof callback === 'function') { callback(true); } }); $("div.alert_window button#btn_cancel").click(function(){ $.unblockUI(); if (typeof callback === 'function') { callback(false); } }); }, loading: function(message) { if (!message || message === "" || message === null || message === false) { message = idioma.procesando_msj_txt; } $.blockUI({ message: "" + "

"+message+"

" + "" }); }, search: function() { var busqueda = $('#campo_buscar').val(); window.location.href = RCN.url + 'index.php/page,search/for,' + encodeURI(busqueda); } }); /* users.js */ _.extend({ users: { alert : function(message, callback) { $.blockUI({ message: "" + "

" + "

"+message+"

" + "" + "

" }); $("div.alert_window button#btn_ok").click(function(){ $.unblockUI(); if (typeof callback === 'function') { callback(); } }); }, login: function() { $.post("index.php/mode,json/control,Users.validateLogin/", { username: $('input#login_username').val(), password: $('input#login_password').val() }, function(json) { if (json.status == 201) { window.location.reload(); } else { _.alert(idioma.login_error_txt); } }, "json"); }, logout: function() { $.post("index.php/mode,json/control,Users.logOut/", function() { location.href = RCN.url; }); }, recover: function() { $('input#recover_username').val(""); $.blockUI({ message: $("#recover"), css: { width: '350px' } }); $('#recover #btn_cancel:first').click(function(){ $('#recover .error').html(''); $.unblockUI(); }); $('#recover #btn_ok:first').click(function() { $('#recover .error').html('Procesando...'); $.post("index.php/mode,json/control,Users.recoverPassword/", { username: $('input#recover_username').val() }, function(json) { if (json.status == 401) { $('#recover .error').html(idioma.users_recover_error_401_txt); } else if (json.status == 402) { _.alert(idioma.users_recover_error_402_txt); } else if (json.status == 201) { _.alert(idioma.users_recover_msj_201_txt); } }, "json"); }); } } });